package tests;

import junit.framework.TestCase;

/**
 * Title: SavesTest class for CSIS 343 Final Project 
 * Description: CS 343 Final Project - SavesTest This class will test the Saves class 
 * 
 * @author Erik Olson
 * @email erik.olson-5@my.uwrf.edu
 * @author Mike Harmon
 * @email michael.harmon@my.uwrf.edu
 * @author Jack Friermuth
 * @email jack.friermuth@my.uwrf.edu
 * @author Luke Vang
 * @email luke.vang@my.uwrf.edu
 * @author Casey Golla
 * @email casey.golla@my.uwrf.edu
 * @date December 4th 2012
 */
public class SavesTest extends TestCase {
	private static com.project.savelog.Saves saves_default;
	private static com.project.savelog.Saves saves_alternate;

	protected static void setUpBeforeClass() throws Exception {
	}

	protected static void tearDownAfterClass() throws Exception {
	}

	protected void setUp() throws Exception {
		//setting up 2 dummy objects
		saves_default = new com.project.savelog.Saves();
		saves_alternate =  new com.project.savelog.Saves( 1, 1, "blah", "2013/11/28", "2013/11/28", "/home/mike", 1 );
	}

	protected void tearDown() throws Exception {
		//clearing the objects out
		saves_default = null;
		saves_alternate = null;
	}
	
	/**
	 * Tests that the default constructor will set the correct defaults
	 * @Test
	 */
	public final void testDefaultConstructor() {
		assertEquals( saves_default.getSave_id(), 0, 0 );
		assertEquals( saves_default.getGame_id() , 0, 0 );
		assertEquals( saves_default.getSave_descrip() , "");
		assertEquals( saves_default.getSave_date_created(), "" );
		assertEquals( saves_default.getSave_date_logged(), "" );
		assertEquals( saves_default.getSave_src(), "" );
		assertEquals( saves_default.getDev_id(), 0, 0 );
	}
	
	/**
	 * Tests that the alternate constructor will set the provided values
	 * @Test
	 */
	public final void testAlternateConstructor() {
		assertEquals( saves_alternate.getSave_id(), 1, 0 );
		assertEquals( saves_alternate.getGame_id() , 1, 0 );
		assertEquals( saves_alternate.getSave_descrip() , "blah");
		assertEquals( saves_alternate.getSave_date_created(), "2013/11/28" );
		assertEquals( saves_alternate.getSave_date_logged(), "2013/11/28" );
		assertEquals( saves_alternate.getSave_src(), "/home/mike" );
		assertEquals( saves_alternate.getDev_id(), 1, 0 );
	}
	
	/**
	 * Tests that getSave_id will return the save id
	 * @Test
	 */
	public final void testGetSave_id() {
		assertEquals( saves_alternate.getSave_id(), 1, 0 );
	}
	
	/**
	 * Tests that setSave_id will correctly set the save id
	 * @Test
	 */
	public final void testSetSave_id() {
		saves_alternate.setSave_id( 2 );
		assertEquals( saves_alternate.getSave_id(), 2, 0 );
	}
	
	/**
	 * Tests that getGame_id will return the correct game id
	 * @Test
	 */
	public final void testGetGame_id() {
		assertEquals( saves_alternate.getGame_id() , 1, 0 );
	}
	
	/**
	 * Tests that setGame_id will correctly set the game id
	 * @Test
	 */
	public final void testSetGame_id() {
		saves_alternate.setGame_id( 2 );
		assertEquals( saves_alternate.getGame_id() , 2, 0 );
	}
	
	/**
	 * Tests that getSave_descrip will return the correct save description
	 * @Test
	 */
	public final void testGetSave_descrip() {
		assertEquals( saves_alternate.getSave_descrip() , "blah");
	}
	
	/**
	 * Tests that setSave_descrip will correctly set the save description
	 * @Test
	 */
	public final void testSetSave_descrip() {
		saves_alternate.setSave_descrip( "new description" );
		assertEquals( saves_alternate.getSave_descrip() , "new description");
	}
	
	/**
	 * Tests that getSave_date_created will return the correct date
	 * @Test
	 */
	public final void testGetSave_date_created() {
		assertEquals( saves_alternate.getSave_date_created(), "2013/11/28" );
	}
	
	/**
	 * Tests that setSave_date_created will correctly set the save date created
	 * @Test
	 */
	public final void testSetSave_date_created() {
		saves_alternate.setSave_date_created("2013/11/29");
		assertEquals( saves_alternate.getSave_date_created(), "2013/11/29" );
	}
	
	/**
	 * Tests that getSave_date_logged will return the correct date
	 * @Test
	 */
	public final void testGetSave_date_logged() {
		assertEquals( saves_alternate.getSave_date_logged(), "2013/11/28" );
	}
	
	/**
	 * Tests that setSave_date_logged will correctly set the save date logged
	 * @Test
	 */
	public final void testSetSave_date_logged() {
		saves_alternate.setSave_date_logged( "2013/11/29" );
		assertEquals( saves_alternate.getSave_date_logged(), "2013/11/29" );
	}
	
	/**
	 * Tests that getSave_src will return the correct path
	 * @Test
	 */
	public final void testGetSave_src() {
		assertEquals( saves_alternate.getSave_src(), "/home/mike" );
	}
	
	/**
	 * Tests that setSave_src will correctly set the save source path
	 * @Test
	 */
	public final void testSetSave_src() {
		saves_alternate.setSave_src( "/my/new/path" );
		assertEquals( saves_alternate.getSave_src(), "/my/new/path" );
	}
	
	/**
	 * Tests that getDev_id will return the correct device id
	 * @Test
	 */
	public final void testGetDev_id() {
		assertEquals( saves_alternate.getDev_id(), 1, 0 );
	}
	
	/**
	 * Tests that setDev_id will correctly set the device id
	 * @Test
	 */
	public final void testSetDev_id() {
		saves_alternate.setDev_id( 2 );
		assertEquals( saves_alternate.getDev_id(), 2, 0 );
	}
	

}
